<template>
	<yd-flexbox direction="vertical">
		<!--头部公共组件-->
		<div v-show="iscolse" ref="topopen" id="topopen">
			<div class="left">
				<img class="left-img" src="../assets/img/images/head_1.png" />
			</div>
			<div class="topopen-right">
					<div class="btn" @click="setOpenApp('https://apis.zhudd.com/openApp.html')"><img src="../assets/img/images/head_2.png" /></div>
				<div class="topopen-right-close"><img @click="colse" src="../assets/img/images/head_3.png" /></div>
			</div>
		</div>
		<!--网页头部-->
		<div class="index-top" v-show="isnav">
			<img @click="SideslipMenu()" class="index-topon" src="../assets/img/home/top/images/icon_03.gif" />
			<router-link to="/"><img @click="indexclick" class="index-toptw" src="../assets/img/home/top/images/icon_05.gif" /></router-link>
			<img @click="search()" class="index-topth" src="../assets/img/home/top/images/icon_07.png" />
		</div>
	</yd-flexbox>
</template>
<script>
	import { mapGetters, mapActions } from 'vuex'
	import eventBus from '../assets/libs/eventBus.js'
	export default {
		name: 'Myheader',
		data() {
			return {
				iscolse: true,
				isnav: true,
				mess:"22"
			}
		},
		mounted(){
				var that = this;
			eventBus.$on('msg', (e) => {
				that.isnav = e
			})
		},
		methods: {
			...mapActions({
				setOpenApp:'setOpenApp'
			}),
			SideslipMenu() {
				var that = this;
				that.isnav = false;
				that.$router.push({
					path: "/SideslipMenu",
					query: {}
				})
			},
			indexclick() {

				document.body.style.overflow = "visible";
				document.querySelector("html").style.overflow = "visible";
			},
			//			搜索
			search() {
				var that = this;
				document.body.style.overflow = "visible";
				document.querySelector("html").style.overflow = "visible";
				that.$router.push({
					path: "/search",
					query: {
						cityId: sessionStorage.getItem("cityId"),
						city: true
					}
				})
			},
			colse() {
				var that = this;
				that.iscolse = false;
				let acctoppx = $(".housenav-accordion").css("top");
				let mask_calendarpx = $(".housenavitem .mask_calendar").css("top");
				let htmlsize = $("html").css("font-size");
				let acctoprem = parseFloat(acctoppx) / parseFloat(htmlsize) - 1.27;
				let mask_calendarrem = parseFloat(mask_calendarpx) / parseFloat(htmlsize) - 1.27;
				$(".housenav-accordion").css("top", acctoprem + "rem")
				$(".mask_calendar").css("top", mask_calendarrem + "rem")
			}
		}
	}
</script>

<style scoped>
	#topopen {
		width: 100%;
		height: 1.27rem;
		padding: 0 .24rem;
		box-sizing: border-box;
		background: #2e2e2e;
		display: -webkit-flex;
		justify-content: space-between;
		align-items: center;
	}
	
	.left-img {
		width: 3.63rem;
		height: .67rem;
	}
	
	.topopen-right-close>img {
		display: block;
		width: .25rem;
		height: .25rem;
	}
	
	.topopen-right {
		display: -webkit-flex;
		align-items: center;
	}
	
	.btn img {
		display: block;
		width: 1.38rem;
		height: .47rem;
		margin-right: .35rem;
	}
	/*@media only screen and (max-width: 380px) {
		#topopen {
			padding: 0.3rem 0.2rem 0.3rem 0.2rem;
		}
	}*/
	/*<!--网页头部-->*/
	
	.index-top {
		width: 100%;
		padding: .08rem .24rem;
		box-sizing: border-box;
		background: #fff;
		display: -webkit-flex;
		justify-content: space-between;
	}
	
	.index-topon {
		width: .38rem;
		height: .67rem;
	}
	
	.index-toptw {
		width: .67rem;
		height: .67rem;
	}
	
	.index-topth {
		width: .51rem;
		height: .67rem;
	}
</style>